
#include "coordinate3D.h"
#include "math.h"

coord3D::coord3D()
{

}

coord3D::coord3D(float x_new, float y_new, float z_new) 
{ 
	xValue = x_new;
	yValue = y_new;
	zValue = z_new;
}

void coord3D::setValues(float x_new, float y_new, float z_new){
        xValue = x_new;
        yValue = y_new;
        zValue = z_new;
}

bool coord3D::isEqual(coord3D other){
    if (round(this->x())==round(other.x())&&
        round(this->y())==round(other.y())&&
        round(this->z())==round(other.z())){
        return true;
    }
    else
        return false;
}

float coord3D::x()
{
	return xValue;
}
	
float coord3D::y()
{
	return yValue;
}

float coord3D::z()
{
	return zValue;
}

vector3D coord3D::toVector(coord3D head){
    return vector3D(head.x()-this->x(),head.y()-this->y(),head.z()-this->z()).normalize();
}

float coord3D::round(float x){
    return floor(x*100.0+0.5)/100;
}
